package com.ruoyi.departmental.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.departmental.domain.HisDepartmentalSection;
import com.ruoyi.departmental.mapper.HisDepartmentalSectionMapper;
import com.ruoyi.departmental.service.IHisDepartmentalSectionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 科室Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-08-30
 */
@Service
public class HisDepartmentalSectionServiceImpl implements IHisDepartmentalSectionService 
{
    @Autowired
    private HisDepartmentalSectionMapper hisDepartmentalSectionMapper;

    /**
     * 查询科室
     * 
     * @param sectionId 科室主键
     * @return 科室
     */
    @Override
    public HisDepartmentalSection selectHisDepartmentalSectionBySectionId(Long sectionId)
    {
        return hisDepartmentalSectionMapper.selectHisDepartmentalSectionBySectionId(sectionId);
    }

    /**
     * 查询科室列表
     * 
     * @param hisDepartmentalSection 科室
     * @return 科室
     */
    @Override
    public List<HisDepartmentalSection> selectHisDepartmentalSectionList(HisDepartmentalSection hisDepartmentalSection)
    {
        return hisDepartmentalSectionMapper.selectHisDepartmentalSectionList(hisDepartmentalSection);
    }

    /**
     * 新增科室
     * 
     * @param hisDepartmentalSection 科室
     * @return 结果
     */
    @Override
    public int insertHisDepartmentalSection(HisDepartmentalSection hisDepartmentalSection)
    {
        hisDepartmentalSection.setCreateTime(DateUtils.getNowDate());
        return hisDepartmentalSectionMapper.insertHisDepartmentalSection(hisDepartmentalSection);
    }

    /**
     * 修改科室
     * 
     * @param hisDepartmentalSection 科室
     * @return 结果
     */
    @Override
    public int updateHisDepartmentalSection(HisDepartmentalSection hisDepartmentalSection)
    {
        hisDepartmentalSection.setUpdateTime(DateUtils.getNowDate());
        return hisDepartmentalSectionMapper.updateHisDepartmentalSection(hisDepartmentalSection);
    }

    /**
     * 批量删除科室
     * 
     * @param sectionIds 需要删除的科室主键
     * @return 结果
     */
    @Override
    public int deleteHisDepartmentalSectionBySectionIds(Long[] sectionIds)
    {
        return hisDepartmentalSectionMapper.deleteHisDepartmentalSectionBySectionIds(sectionIds);
    }

    /**
     * 删除科室信息
     * 
     * @param sectionId 科室主键
     * @return 结果
     */
    @Override
    public int deleteHisDepartmentalSectionBySectionId(Long sectionId)
    {
        return hisDepartmentalSectionMapper.deleteHisDepartmentalSectionBySectionId(sectionId);
    }
}
